package com.yu.smsinterceptor.adapter;

import android.content.Context;
import android.widget.TextView;

import com.yu.smsinterceptor.R;
import com.yu.smsinterceptor.mode.Message;

import java.util.List;

/**
 * 拦截的短信列表的适配器
 */
public class MessageListAdapter extends BaseRecyclerAdapter<Message> {

    /**
     * @param context
     * @param data
     */
    public MessageListAdapter(Context context, List<Message> data) {
        super(context, data);
    }

    @Override
    public void bindData(BaseViewHolder holder, Message message) {
        TextView tv_phoneNumber = (TextView) holder.getView(R.id.tv_phone_number);
        TextView tv_content = (TextView) holder.getView(R.id.tv_content);
        TextView tv_receiverTime = (TextView) holder.getView(R.id.tv_receiver_time);

        tv_receiverTime.setText(message.getId().toString());
        tv_content.setText(message.getContent());
        tv_phoneNumber.setText(message.getReceiverTime().toString());
    }

    @Override
    public int getItemLayoutId() {
        return R.layout.item_message;
    }
}
